package com.ruoyi.parkinglot.controller;

import com.ruoyi.parkinglot.service.ParkRoadService;
import com.ruoyi.parkinglot.utils.Result;
import com.ruoyi.parkinglot.domain.ParkRoad;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/parkRoad")
public class ParkRoadController {
    @Resource
    private ParkRoadService parkRoadService;

    /**
     * 根据道路ID查询道路信息
     *
     * @param roadId 道路ID
     * @return 道路信息
     */
    @GetMapping("/getById/{roadId}")
    public Result getRoadById(@PathVariable("roadId") Long roadId) {
        ParkRoad road = parkRoadService.getRoadById(roadId);
        return Result.success(road);
    }
    /**
     * 查询所有道路信息
     */
    @GetMapping("/list")
    public Result list() {
        List<ParkRoad> list = parkRoadService.selectRoadListByArea();
        return Result.success(list);
    }
}
